/*--------------------------------------------------------------------------
 * AppController.m
 *
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 *
 *
 *	A controller class for the Radio Button association example.
 *
 *------------------------------------------------------------------------*/
#import <eointerface/EOController.h>
#import <foundation/NSString.h>

#import "AppController.h"
#import "DataSource.h"
#import "Person.h"


@implementation AppController

/*--------------------------------------------------------------------------
 *	Cover Methods for EOController Actions
 *------------------------------------------------------------------------*/
- fetch: sender
{
	[eoController fetch: sender];
	return self;
}



/*--------------------------------------------------------------------------
 *	Initialization
 *------------------------------------------------------------------------*/
- appDidInit: sender
{
	// Initialize 'persistentStore' with a couple of objects
	
	id	object;
	
	object = [dataSource createObject];
	[object setFirstname: @"Alan"];
	[object setLastname: @"Smith"];
	[object setCity: @"Woodside"];
	[dataSource insertObject: object];
	
	object = [dataSource createObject];
	[object setFirstname: @"Greg"];
	[object setLastname: @"Thierry"];
	[object setCity: @"Redwood City"];
	[dataSource insertObject: object];
	
	object = [dataSource createObject];
	[object setFirstname: @"Jennifer"];
	[object setLastname: @"Walton"];
	[object setCity: @"Palo Alto"];
	[dataSource insertObject: object];

	object = [dataSource createObject];
	[object setFirstname: @"Tom"];
	[object setLastname: @"Liu"];
	[object setCity: @"Sunnyvale"];
	[dataSource insertObject: object];

	object = [dataSource createObject];
	[object setFirstname: @"John"];
	[object setLastname: @"Affinito"];
	[object setCity: @"Redwood City"];
	[dataSource insertObject: object];

	object = [dataSource createObject];
	[object setFirstname: @"Denise"];
	[object setLastname: @"Tautz"];
	[object setCity: @"Woodside"];
	[dataSource insertObject: object];

	object = [dataSource createObject];
	[object setFirstname: @"Alex"];
	[object setLastname: @"Upson"];
	[object setCity: @"Mountain View"];
	[dataSource insertObject: object];

	object = [dataSource createObject];
	[object setFirstname: @"Ken"];
	[object setLastname: @"Nguyen"];
	[object setCity: @"San Jose"];
	[dataSource insertObject: object];

	object = [dataSource createObject];
	[object setFirstname: @"Donna"];
	[object setLastname: @"Kensaki"];
	[object setCity: @"Palo Alto"];
	[dataSource insertObject: object];
	
	object = [dataSource createObject];
	[object setFirstname: @"David"];
	[object setLastname: @"Veasey"];
	[object setCity: @"Belmont"];
	[dataSource insertObject: object];

	[dataSource saveObjects];
	[self fetch: nil];
	return self;
}


@end
